<template>
  <div class="collect">
    <p>
      <van-icon name="arrow-left" @click="$router.go(-1)" />
      <span class="title">我的收藏</span>
    </p>
    <div class="collectlist">
      <div class="item" v-for="(item, index) in collectlist" :key="index">
        <div class="left">
          <img :src="item.picUrl" alt="">
        </div>
        <div class="right">
          <div class="name">
            {{ item.name }}
          </div>
          <div class="show">
            <div class="pingfen">☆{{ item.wmPoiScore / 10 }}</div>
            <div class="sales">
              {{ item.monthSalesTip }}
            </div>
            <van-tag type="primary" size="medium">商家配送</van-tag>
          </div>
          <div class="message">
            <div class="take">
              {{ item.minPriceTip }}
              {{ item.shippingFeeTip }}
            </div>
            <div class="time">
              {{ item.deliveryTimeTip }}
              {{ item.distance }}
            </div>
          </div>
        </div> 
      </div>
      <div v-show="collectlist.length == 0" class="empty">还未收藏</div>
      <div class="tip">已全部加载完</div>
    </div>
  </div>
</template>

<script>
import { shop_favlist } from "../api/index";
export default {
  data() {
    return {
      collectlist: [],
    };
  },
  mounted() {
    shop_favlist({userid:JSON.parse(localStorage.getItem('userinfo')).id}).then((res) => {
      this.collectlist = res.data.list;
    });
  },
};
</script>

<style>
.collect {
  width: 360px;
  height: 600px;
  background-color: #fff;
  margin: 30px auto;
}
p {
  height: 40px;
  line-height: 40px;
  font-size: 28px;
  color: rgb(5, 148, 237);
  cursor: pointer;
  /* background-color: red; */
}
p .title {
    display: inline-block;
  height: 40px;
  font-size: 22px;
  font-weight: 700;
  color: black;
  vertical-align: top;
  /* background-color: #fff; */
}
.collectlist{
    height: 560px;
    padding: 30px 0;
    /* background-color: aquamarine; */
}
.item{
    height: 80px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    background-color: #fff;
}
.left{
    width: 80px;
    height: 80px;
}
.left img{
    width: 100%;
    height: 100%;
}
.right{
    width: 250px;
    font-size: 12px;
    color: gray;
}
.name{
    font-weight: 700;
    height: 30px;
    font-size: 14px;
    color: black;
}
.show,.message{
    display: flex;
    justify-content: space-between;   
    margin-bottom: 10px;
}
.pingfen{
    color: red;
    margin-right: 10px;
}
.sales{
    flex: 1;  
}
.tip{
    height: 50px;
    line-height: 50px;
    color: gray;
    text-align: center;
    border-top: 1px solid gainsboro;
}
.empty{
    line-height: 50px;
    text-align: center;
}
</style>